package com.bookstore.service;

import com.bookstore.entity.Download;
import com.bookstore.mapper.DownloadMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Service
public class DownloadService {
    @Autowired
    private DownloadMapper downloadMapper;

    @Transactional
    public void addDownloadRecord(Long uId,String bid){
        Download download = new Download();
        download.setbId(bid);
        download.setuId(uId);
        download.setDownloadDate(new Date());
        downloadMapper.insertSelective(download);
    }
}
